package com.zzy.app.config.factorybean;

import com.zzy.app.entity.Color;
import org.springframework.beans.factory.FactoryBean;

/**
 * 创建一个spring定义的factory bean
 * T：指定创建的对象类型
 */
public class ColorFactoryBean implements FactoryBean<Color> {
    /**
     * 返回一个Color，添加到容器中
     * @return
     * @throws Exception
     */
    @Override
    public Color getObject() throws Exception {
        System.out.println("ColorFactoryBean>>>getObject");
        return new Color();
    }

    @Override
    public Class<?> getObjectType() {
        return Color.class;
    }

    @Override
    public boolean isSingleton() {
        return false;
    }
}
